import React from 'react'
import { useParams, useLocation, useSearchParams } from 'react-router-dom'
export default function About() {
  // 接收路由参数
  const params = useParams()
  // console.log(params)

  // 接收locaiton.state数据
  const location = useLocation()
  console.log('location', location)

  // query里面存储了查询字符串的数据, setQuery是修改查询字符串的方法
  const [query, setQuery] = useSearchParams()
  console.log('query', query)
  console.log('query', query.get('name'))
  console.log('query', query.get('xxx'))
  return (
    <div>
      <h1>关于页</h1>
      <button
        onClick={() => {
          setQuery('yyy=aaaa')
        }}
      >
        修改查询字符串
      </button>
    </div>
  )
}
